

//
//  ZSetViewController.m
//  ZQLearn
//
//  Created by macfeel on 2019/4/21.
//  Copyright © 2019 macfeel. All rights reserved.
//

#import "ZSetViewController.h"

@interface ZSetViewController ()
@property (weak, nonatomic) IBOutlet UIView *clearView;
@property (weak, nonatomic) IBOutlet UIButton *logoutBtn;
@property (weak, nonatomic) IBOutlet UILabel *countMemoryLab;

@property (weak, nonatomic) IBOutlet UILabel *versionLab;


@end

@implementation ZSetViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.navigationItem setItemWithTitle:@"设置" textColor:kNavigationTitleColor fontSize:18 itemType:center];
    self.logoutBtn.layer.cornerRadius = 5.f;
    self.logoutBtn.layer.masksToBounds = YES;
    
    UITapGestureRecognizer *tap = [[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(tapClear:)];
    [self.clearView addGestureRecognizer:tap];
    
    self.logoutBtn.backgroundColor = NColorFrom16RGB(0x28affe);
    
    ///这个是build号
//    NSString *version = [[[NSBundle mainBundle] infoDictionary] objectForKey:(NSString *)kCFBundleVersionKey];//获取项目版本号
    
    ///这个是version 号
   NSString *verson1 =  [[NSBundle mainBundle] objectForInfoDictionaryKey:@"CFBundleShortVersionString"];

    self.versionLab.text = [NSString stringWithFormat:@"V%@",verson1];
    // Do any additional setup after loading the view from its nib.
}

- (void)tapClear:(UITapGestureRecognizer *)tap
{
    YYLog(@"清楚缓存");
    [SVProgressHUD show];
    dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
        [SVProgressHUD dismiss];
        [AFToast showText:@"清理成功"];
        self.countMemoryLab.text = @"0M";
    });
    
}

- (IBAction)logoutBtnAction:(UIButton *)sender {
    
//    YYLog(@"退出");
    ///退出登录
    [self callLoginVC];
    ///退出登录后续还需要清空其他数据
    [[NSUserDefaults standardUserDefaults]setObject:@"" forKey:kUserId];
    [[NSUserDefaults standardUserDefaults]synchronize];
}

@end
